package com.cloud.point.concurrent.openHFT;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import lombok.extern.slf4j.Slf4j;
import net.openhft.affinity.AffinityLock;
import net.openhft.affinity.AffinityStrategies;
import net.openhft.affinity.AffinityThreadFactory;

/**
 * TestThreadBundld
 *
 * @author 24373
 * @version 1.0
 * @date 2024-06-28 12:34
 */
@Slf4j
public class TestThreadBundle {
    private static final ExecutorService ES = Executors.newFixedThreadPool(4,
            new AffinityThreadFactory("bg", AffinityStrategies.SAME_CORE, AffinityStrategies.DIFFERENT_SOCKET, AffinityStrategies.ANY));

    public static void main(String[] args) {
        int i = Runtime.getRuntime().availableProcessors();
        AffinityLock affinityLock1 = AffinityLock.acquireCore(true);
        try (AffinityLock affinityLock = AffinityLock.acquireLock(5)) {
            while (true) {
                //log.info("blocking");
            }
        }
    }

}
